﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Library;
using Microsoft.Reporting.WinForms;

namespace QLKH.View.report
{
    public partial class reportCQcophi : Form
    {
        public reportCQcophi()
        {
            InitializeComponent();
            this.Height = Screen.PrimaryScreen.WorkingArea.Height; //ConfigForm.height;
            this.Width = Screen.PrimaryScreen.WorkingArea.Width;//configForm.width
        }

        private void reportCQcophi_Load(object sender, EventArgs e)
        {

            this.reportViewerCQphi.RefreshReport();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string ngaylap = dateview.Value.ToString("MM/dd/yyyy");
            clReport CQcp = new clReport();
            DataTable dt = CQcp.reportCQcophi(ngaylap);
            ReportDataSource rpcq = new ReportDataSource();
            rpcq.Name = "DatasetCQcophi";
            rpcq.Value = dt;
            
            this.reportViewerCQphi.Reset();
            this.reportViewerCQphi.LocalReport.ReportEmbeddedResource = "QLKH.View.report.BanKeBienLaiCoQuanCoPNT.rdlc";
            this.reportViewerCQphi.LocalReport.DataSources.Clear();
            this.reportViewerCQphi.LocalReport.DataSources.Add(rpcq);

            IList<ReportParameter> param = new List<ReportParameter>();
            param.Add(new ReportParameter("Ngaylap", ngaylap));

            reportViewerCQphi.LocalReport.SetParameters(param);

            this.reportViewerCQphi.RefreshReport();
            //this.reportViewerCQphi.ZoomPercent = 100;
            this.reportViewerCQphi.SetDisplayMode(DisplayMode.PrintLayout);
            this.reportViewerCQphi.ZoomMode = ZoomMode.Percent;
            this.reportViewerCQphi.ZoomPercent = 100;
        }

        private void btquit_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
